<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .test:not(div) {
      color: red;
    }
    .test:not(div):not(p) {
      color: aquamarine;
    }
  </style>
</head>
<body>
  <div class="test">ppppp</div>
  <p class="test">ddddd</p>
  <span class="test">bbbbb</span>
</body>
</html>